//
//  PaperCollect.m
//  DoingPaper_LS
//
//  Created by zhuxuhong on 2016/10/24.
//  Copyright © 2016年 zhuxuhong. All rights reserved.
//

#import "PaperCollect.h"

@implementation PaperCollect

+(instancetype)collectWithDictionary: (NSDictionary*)dict{
    PaperCollect *collect = [self new];
    [collect setValuesForKeysWithDictionary:dict];
    return collect;
}

-(void)setValue:(id)value forKey:(NSString *)key{
    if ([key isEqualToString:@"question"]) {
        _questions = [NSMutableArray new];
        for (NSDictionary *dict in value) {
            PaperCollectQuestion *q = [PaperCollectQuestion questionWithDictionary:dict];
            [_questions addObject:q];
        }
        return;
    }
    else if([key isEqualToString:@"paperId"]){
        _paperId = [NSString stringWithFormat:@"%@",value];
        return;
    }
    [super setValue:value forKey:key];
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
}


@end
